Repository navigation
Split commons() into two - #414
Conversation
|
Will need to think through DuckDB and context search:
|
This comment was marked as outdated.
This comment was marked as outdated.
|
MCP-CONSOLE ALLOWS US TO EDIT THE TOOL DESCRIPTION NOW YIPPEE |
# Conflicts: # pkg-r/R/commons.R
|
Preview deployed to Connect ( Deployed from commit 15aa5d0. |
|
Preview deployed to Connect ( Deployed from commit 15aa5d0. |
|
In devrel-agent with Posit Assistant: commons-in-posit-assistant.mov |
|
We should talk about how to make multiple commons agents available in one R session in the docs. |
|
Regardless of anything else you should recommend a fully named call for |
|
[EDIT: this is now done] Should rename commons <- commons(data_sources = data_sources, semantic_layer = semantic_layer, context_layer = context_layer)
agent <- agent(client, commons = commons)
For now, this should be backward-compatible, raising a |
`commons()` now returns the commons: data sources, semantic layer, and context layer, callable without a model. Its arguments must be named. `agent(client, commons = )` builds the agent. Calls that pass a client to `commons()` still return an agent, with a deprecation warning.
There was a problem hiding this comment.
See here for the write-up of the changes.
| #' If the commons has a context layer, `$context()` needs one more step for | ||
| #' now. It relies on DuckDB's `fts` extension, which MCP Console's sandbox | ||
| #' can't download. MCP Console can install the extension itself, but only | ||
| #' into its own cache, which R's duckdb doesn't read by default. Point R at | ||
| #' that cache with an absolute path (`~` and environment variables aren't | ||
| #' expanded): | ||
| #' | ||
| #' ```yaml | ||
| #' environment: | ||
| #' # macOS; on Linux, /home/you/.cache/mcp-console/dependencies/duckdb | ||
| #' DUCKDB_R_HOME: /Users/you/Library/Caches/mcp-console/dependencies/duckdb | ||
| #' ``` | ||
| #' | ||
| #' Then add one more sentence to both `tool.description` and | ||
| #' `tool.instructions`, so the agent asks MCP Console to install the | ||
| #' extension: | ||
| #' | ||
| #' ```markdown | ||
| #' The first time you run `commons$context()`, include | ||
| #' `"requirements": {"duckdb": ["fts"]}` in the same call. | ||
| #' ``` |
There was a problem hiding this comment.
There's a comment above about an issue with the needed extensions for DuckDB and context search. I decided to just temporarily document the workaround for users in favor of #455, removing the needed for ragnar/duckdb in context search altogether.
Another approach could be to have Tomasz add a configuration option in mcp-console that would allow us to pre-install extensions on install.
Agent-written code review from GPT 6.1 Sol — two findingsReviewed ee1da47. [P2] Preserve quoted literals in [P2] Load pending pins before returning their connection ( Both reproduced locally. Focused Edit: addressed both. |
|
I will take a closer look at this in a bit, but what do you think about also having a way to resolve custom SQL that uses dictionary definitions? Ordinary SQL can already be run with I have not thought about this much from an interoperability angle, but it would be helpful (but not critical) for the reproducibility work in #428. It would be useful from an interoperability stance if you want to write custom SQL that uses a dictionary definition without copying and pasting from the dictionary. |
Thanks, this was an oversight on my part. |
$run_sql() expands governed definitions as {{name}} tokens and refuses
writes, as the agent's run_sql tool does. MCP Console now builds commons
from .Rprofile, since its startup block must select a SQL connection.
jat255
left a comment
There was a problem hiding this comment.
Generally, I like this direction. Some small comments and a few little R things identified by Opus (I verified, but definitely wouldn't have found them without it :D).
I'll open an issue to bring Python in sync with this architecture.
|
Cleaned up 15 preview bundle(s) on https://dogfood.team.pct.posit.it: 382623, 382626, 382629, 382630, 382631, 382634, 382639, 382642, 383283, 383284, 383291, 383294, 383664, 383666, 384054 |
|
Cleaned up 15 preview bundle(s) on https://connect.staging.pct.posit.it: 3737, 3738, 3739, 3740, 3741, 3742, 3744, 3746, 3782, 3785, 3786, 3788, 3849, 3851, 3930 |
...with interoperability in mind. Closes #410. The recommended way to write:
becomes:
Implemented backward-compatibly.
commons()'s output is "just" the data structure that holds the trusted code and output, and not the stuff that hooks into an agent harness so external agents can invoke search and call trusted code and context via methods on the output.For external coding agents, the flow is that they'd register
mcp-consolewithcommons <- commons()in the startup script and a sentence added to the tool descriptuon. For Posit Assistant, this would be an entry in.Rprofileand a sentence in AGENTS.md.